import {Component, OnInit} from '@angular/core';

@Component({
    selector: 'app-calculator',
    templateUrl: './calculator.component.html',
    styleUrls: ['./calculator.component.less']
})
export class CalculatorComponent implements OnInit {
    public formulas: string;
    public formulasValue: any;
    constructor() {
    }

    ngOnInit() {
    }
    keyDown(e) {
        if (e.keyCode === 13) {
          this.calculatorIng();
        }
    }
    calculatorIng() {
        this.formulasValue = eval(this.formulas);
    }
}
